<!-- 假数据页面 -->
<template>
  <div>
    <div style="height: 20px"></div>
    <!-- 维修记录 -->
    <div v-if="currentItemIndex[0] === '0'" class="content">
      <div class="message">
        <h5 class="margin-left:10px">报修单:</h5>
        <van-form  >
          <van-field
            v-model="weixiuarr[currentIndex].a"
            name="维修设备"
            label="维修设备"
          />
          <van-field
            v-model="weixiuarr[currentIndex].b"
            name="故障描述"
            label="故障描述"
          />
          <van-field
            v-model="weixiuarr[currentIndex].c"
            name="维修建议/方案"
            label="维修建议/方案"
          />
          <van-field
            v-model="weixiuarr[currentIndex].d"
            name="维修费用"
            label="维修费用"
          />
          <van-field
            v-model="weixiuarr[currentIndex].e"
            name="报修人"
            label="报修人"
          />
        </van-form>
      </div>
      <van-divider />
      <div class="message">
        <h5 class="margin-left:10px">维修单:</h5>
        <van-form >
          <van-field
            v-model="weixiuarr[currentIndex].f"
            name="维修描述"
            label="维修描述"
          />
          <van-field
            v-model="weixiuarr[currentIndex].h"
            name="维修建议/方案"
            label="维修建议/方案"
          />
          <van-field
            v-model="weixiuarr[currentIndex].g"
            name="维修费用"
            label="维修费用"
          />
          <van-field
            v-model="weixiuarr[currentIndex].e"
            name="报修人"
            label="报修人"
          />
        </van-form>
      </div>
      <van-divider />
    </div>
    <!-- 维保记录 -->
    <div v-if="currentItemIndex[0] === '1'" class="content">
      <div class="message">
        <h5 class="margin-left:10px">设备</h5>
        <van-form >
          <van-field
            v-model="weibaoarr[currentIndex].a"
            name="设备状态"
            label="设备状态"
          />
          <van-field
            v-model="weibaoarr[currentIndex].b"
            name="设备名称"
            label="设备名称"
          />
          <van-field
            v-model="weibaoarr[currentIndex].c"
            name="设备编号"
            label="设备编号"
          />
        </van-form>
      </div>
      <van-divider />
      <div class="message">
        <h5 class="margin-left:10px">维保信息:</h5>
        <van-form >
          <van-field
            v-model="weibaoarr[currentIndex].d"
            name="日期"
            label="日期"
          />
          <van-field
            v-model="weibaoarr[currentIndex].e"
            name="维保编号"
            label="维保编号"
          />
          <van-field
            v-model="weibaoarr[currentIndex].f"
            name="项目名称"
            label="项目名称"
          />
          <van-field
            v-model="weibaoarr[currentIndex].g"
            name="维保人"
            label="维保人"
          />
        </van-form>
      </div>
      <van-divider />
    </div>
    <!-- 巡检记录 -->
    <div v-if="currentItemIndex[0] === '2'" class="content">
      <div class="message">
        <h5 class="margin-left:10px">巡检记录</h5>
        <van-form >
          <van-field
            v-model="xunjianarr[currentIndex].a"
            name="检查门锁开启灵活，门体无破损"
            label="检查门锁开启灵活，门体无破损"
          />
          <van-field
            v-model="xunjianarr[currentIndex].b"
            name="检查设备表面无积尘"
            label="检查设备表面无积尘"
          />
          <van-field
            v-model="xunjianarr[currentIndex].a"
            name="检查照明开关完好，使用正常"
            label="检查照明开关完好，使用正常"
          />
          <van-field
            v-model="xunjianarr[currentIndex].b"
            name="检查双路供电正常，开关投入正常"
            label="检查双路供电正常，开关投入正常"
          />
          <van-field
            v-model="xunjianarr[currentIndex].a"
            name="检查各支路供电正常"
            label="检查各支路供电正常"
          />
          <van-field
            v-model="xunjianarr[currentIndex].a"
            name="检查各电气元件外观完好、无发热、无异味"
            label="检查各电气元件外观完好、无发热、无异味"
          />

          <van-field
            v-model="xunjianarr[currentIndex].a"
            name="检查接线牢固无松动脱落现象"
            label="检查接线牢固无松动脱落现象"
          />
          <van-field
            v-model="xunjianarr[currentIndex].a"
            name="检查T接箱在合闸位置无掉闸现象"
            label="检查T接箱在合闸位置无掉闸现象"
          />
          <van-field
            v-model="xunjianarr[currentIndex].c"
            name="存在问题"
            label="存在问题"
          />
          <van-field
            v-model="xunjianarr[currentIndex].d"
            name="巡视人"
            label="巡视人"
          />
        </van-form>
      </div>
      <van-divider />
    </div>
    <!-- 巡更记录 -->
    <div v-if="currentItemIndex[0] === '3'" class="content">
      <div class="message">
        <h5 class="margin-left:10px">巡更记录:</h5>
        <van-form >
          <van-field
            v-model="xungengarr[currentIndex].a"
            name="名称"
            label="名称"
          />
          <van-field
            v-for="item in ['1', '2', '3', '4']"
            :key="item"
            v-model="xungengarr[currentIndex].b"
            :name="'点位' + item + ':A-1-' + item"
            :label="'点位' + item + ':A-1-' + item"
          />
        </van-form>
      </div>
      <van-divider />
      <div class="message">
        <h5 class="margin-left:10px">执行规则设置:</h5>
        <van-form >
          <van-field
            v-model="xungengarr[currentIndex].c"
            name="频率设置"
            label="频率设置"
          />
          <van-field
            v-model="xungengarr[currentIndex].d"
            name="时间设置"
            label="时间设置"
          />
          <van-field
            v-model="xungengarr[currentIndex].e"
            name="负责人"
            label="负责人"
          />
        </van-form>
      </div>
      <van-divider />
    </div>
  </div>
</template>

<script>
import {
  Form,
  Field,
  Divider,
  Checkbox,
  CheckboxGroup,
  Uploader,
  Button
} from 'vant'
export default {
  data () {
    return {
      messageForm: {},
      result: [],
      currentItem: {},
      currentItemIndex: [],
      currentIndex: 0,
      weixiuarr: [
        {
          a: this.currentItem ? this.currentItem : '发电机1',
          b: '噪声过大',
          c: '更换零件',
          d: '30',
          e: '赵女士',
          f: '维修顺利',
          g: '更换零件',
          h: '35'
        },
        {
          a: this.currentItem ? this.currentItem : '发电机2',
          b: '运转时常过长',
          c: '设备维修',
          d: '200',
          e: '王先生',
          f: '维修顺利',
          g: '更换零件',
          h: '189'
        },
        {
          a: this.currentItem ? this.currentItem : '发电机3',
          b: '摩擦严重',
          c: '零件维修',
          d: '300',
          e: '李先生',
          f: '维修顺利',
          g: '更换零件',
          h: '280'
        }
      ],
      weibaoarr: [
        {
          a: '正常',
          b: '空调',
          c: 'A0001',
          d: '2021-09-12',
          e: 'W0001',
          f: '项目A',
          g: '王先生'
        },
        {
          a: '轻微磨损',
          b: '发电机',
          c: 'A0004',
          d: '2021-09-19',
          e: 'W0004',
          f: '项目A',
          g: '王先生'
        },
        {
          a: '急需维修',
          b: '大型设备',
          c: 'A0003',
          d: '2021-09-23',
          e: 'W0009',
          f: '项目A',
          g: '王先生'
        }
      ],
      xunjianarr: [
        {
          a: '正常',
          b: '异常',
          c: '个别项异常，注意排除安全隐患',
          d: '赵工',
          f: '维修顺利',
          g: '更换零件',
          h: '35'
        },
        {
          a: '正常',
          b: '正常',
          c: '无',
          d: '王工'
        },
        {
          a: '正常',
          b: '异常',
          c: '个别项异常，注意排除安全隐患',
          d: '李工',
          f: '维修顺利',
          g: '更换零件',
          h: '35'
        }
      ],
      xungengarr: [
        {
          a: '日常巡更',
          b: '2021-09-18 18:55',
          c: '每天',
          d: '9：00-18：00',
          e: '赵工'
        },
        {
          a: '日常巡更',
          b: '2021-09-23 17:32',
          c: '每天',
          d: '9：30-18：30',
          e: '李工'
        },
        {
          a: '日常巡更',
          b: '2021-09-12 16:46',
          c: '每天',
          d: '9：00-18：00',
          e: '赵工'
        }
      ]
    }
  },

  components: {
    [Form.name]: Form,
    [Field.name]: Field,
    [Divider.name]: Divider,
    [Checkbox.name]: Checkbox,
    [CheckboxGroup.name]: CheckboxGroup,
    [Uploader.name]: Uploader,
    [Button.name]: Button
  },

  computed: {},
  mounted () {
    const params = this.$route.query.pageAndList
    const item = this.$route.query.item
    console.log(item)

    this.currentItemIndex = [params[0], parseInt(params[1])]
    this.currentItem = item
    this.currentIndex = parseInt(params[1]) % 3
  },
  methods: {
    afterRead (file) {
      console.log(file)
    }
  }
}
</script>
<style lang='less' scoped>
.message,
.detail,
.content {
  background: #fff;
}
.content {
  height: 100%;
}
.checkBox-group {
  padding: 10px;
  .detail-item {
    margin-bottom: 5px;
  }
}
</style>
